// Standalone Interpreter
var fml = require("fml"), 
	fs = require("fs"),
	vm = require("vm");

if (/--compile/.test(process.argv)){
	// Run as standalone interpreter
	var file = process.argv[process.argv.indexOf("--compile") + 1],
		out = "";
	if (fml.typeCheck(file, " ")){
		if (fs.existsSync(file)){
			try{
				out = fml.Interpreter(file);
				if (/--out/.test(process.argv)){
					// Save out put to designated file
					file = process.argv[process.argv.indexOf("--out") + 1];
					fs.writeFileSync(file, out);
					console.log("Saved to file: " + file);
				}
				console.log(out);
			}catch (e){
				console.log(e);
			}
		}
	}
}